import java.util.ArrayList;

public class LQB_code1_10 {
    public static void main(String[] args) {
        int x = 5;
        ArrayList<Integer> list = new ArrayList<Integer>();
        while (true){
            for (int i = 2;i<x;i++){
                if(x%i==0) {
                    break;
                }
                if (i==(x-1)){
                    list.add(x);
                }
            }
            if (list.size()==2021){
                System.out.print(x);
                break;
            }
            x+=2;
        }
    }
}
